package com.huaruan.youdi.views.activitys;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.huaruan.youdi.R;
import com.huaruan.youdi.utils.AppUtils;
import com.huaruan.youdi.utils.PreferenceUtil;

import butterknife.BindView;

public class SettingActivity extends BaseActivity {
    @BindView(R.id.ll_modify_password)
    LinearLayout ll_modify_password;
    @BindView(R.id.ll_about)
    LinearLayout ll_about;
    @BindView(R.id.tv_version)
    TextView tv_version;
    @BindView(R.id.tv_out)
    TextView tv_out;

    @Override
    public int IGetContentViewResId() {
        return R.layout.activity_setting;
    }

    @Override
    public void IFindViews() {
        String localVersionCode = "1.0.0";
        try {
            PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
            localVersionCode = packageInfo.versionName + "";
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        tv_version.setText(localVersionCode);

        ll_modify_password.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AppUtils.jump(IGetActivity(), ModifyPasswordActivity.class);
            }
        });

        ll_about.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AppUtils.jump(IGetActivity(), AboutActivity.class);
            }
        });
        tv_out.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PreferenceUtil.putString(PreferenceUtil.PreferenceKeys.UID, "");
                AppUtils.jump(IGetActivity(), LoginActivity.class);
            }
        });
    }

    @Override
    public void IInitData() {

    }
}
